package com.zz.webapp.model;

import com.zz.webapp.dto.UserDto;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * Created by Administrator on 2017/2/1.
 */
@Data
public class UserProfile implements Serializable {
    private static final long serialVersionUID = -5026906834541529802L;
    /**
     * 主键id
     */
    private Long id;
    /**
     * 用户表id
     */
    private Long userId;
    /**
     * 姓名
     */
    private String name;
    /**
     * 性别
     */
    private Integer gender;
    /**
     * 家庭地址
     */
    private String address;
    /**
     * 爱好
     */
    private String hobby;
    /**
     * 工作
     */
    private String industry;
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 更新时间
     */
    private Date updateTime;

    public enum Gender {
        MALE("男",1),
        FEMALE("女",2);
        String desc;
        Integer val;
        Gender(String desc ,Integer val){
            this.desc = desc;
            this.val = val;
        }

        @Override
        public String toString(){
            return  this.desc;
        }
        public Integer getVal(){
            return this.val;
        }
    }
    public UserProfile(){}
    public UserProfile(UserDto userDto, User user){
        this.userId = user.getId();
        this.name = userDto.getName();
        this.gender = userDto.getGender();
        this.address = userDto.getAddress();
        this.hobby = userDto.getHobby();
        this.industry = userDto.getIndustry();
    }
}
